Ext.define('CDR.view.TariffConsoleLogAMQ', {
	extend: 'CDR.view.TariffAMQ',
	alias: 'widget.tariff-amq-console-log',
	myId: "CONSOLE.LOG",
	destination: "topic://CONSOLE.TOPIC",
	layout: 'fit',
	userFilter: null,
	store: null,
	initComponent: function(){
		var me = this;
		me.callParent(arguments);
		//adding view
		me.view = Ext.createWidget('gridpanel', {
			id: 'cdr-tariff-amq-console-log-view',
			autoScroll: true,
			store: me.store,
			columns: [{
				header: 'Data',  
				dataIndex:'parseData', 
				menuDisabled: true,
				flex: 1
			}]
		});
		me.add(me.view);
	},
	getAMQSelector: function(){
		return {selector: "type='console'"};
	},
	handleMessage: function(message){
		//console.log("console receive>>: ", message.nodeValue, typeof message);
		var view = Ext.getCmp('cdr-tariff-amq-console-log-view');
		view.store.insert(0, [{'parseData': message.nodeValue}]);
		if(view.store.count() > 100){
			view.store.removeAt(view.store.count()-1);			
		}
	}
	
});